<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ include file="/parameter.jsp" %>
<%@page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<TITLE>论坛</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<Meta http-equiv="Pragma" Content="No-cach">
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function loginsubmit(){
	return form1.submit();
}
function sendMsg(objMsg){
	alert(ogjMsg);
	return;
}
function SetState(tid,act)
{
	//var act = eval("document.getElementById('state" + num + "')");
	location = "commonAction.do?method=SetTopicState&tid="+ tid +"&state="+ act.value;
}
function SetEssence(tid,act)
{
	//var act = eval("document.getElementById('state" + num + "')");
	location = "commonAction.do?method=SetEssence&tid="+ tid +"&essence="+ act.value;
}
function SearchSubmit(){
	if(document.getElementById('keywords').value == ""){
		alert("请输入搜索关键字！");
		return false;
	}else{
		return document.forms["form3"].submit();
	}
}
function OperatePost(tid){
	var rtnstate= window.confirm("是否确定删除帖子？/r/n单击'确定'继续。单击'取消'停止。");
	if(rtnstate){
		document.frames["hidden1"].location = "commonAction.do?method=CherkIsDelPost&tid=" + tid;
	}
}
function cherkPost(delState,tid){
	if(delState > 0){
		alert("帖子已经有回复信息，没有权限不能删除，请联系版主或管理员进行操作。");
	}else{
		document.forms["form1"].action = "commonAction.do?method=DelPost&tid=" + tid;
		document.forms["form1"].submit();
	}
}
function DelPost(tid){
	var rtnstate=window.confirm("是否确定删除帖子？\r\n删除帖子同时也会删除该帖子的所有回复信息。\r\n单击'确定'继续。单击'取消'停止。");
	if(rtnstate){
		location = "commonAction.do?method=DelPost&tid=" + tid;
	}
}
function MoveTo(tid,act)
{
	if(window.confirm("是否确定移动帖子？\r\n移动帖子同时也会移动该帖子的所有回复信息。\r\n单击'确定'继续。单击'取消'停止。")){
		location = "commonAction.do?method=MoveToBoard&tid="+ tid +"&bid="+ act.value;
	}
}
</script>
</HEAD>
<body>
	<jsp:include page="inc/header.jsp" />
<iframe id="hidden1" name="deltopic" allowtransparency="false" frameborder="0" style="height:0;width:0"></iframe>
		<header class="entry-header">
			<h1 class="entry-title">
				<span>论坛首页<div id="searchbar">
				<form name="form3" method="post" action="commonAction.do?method=SearchTopic">
					<input type="text" id="keywords" name="keywords" title="搜索"><button onClick="SearchSubmit();">搜索</button>
				</form>
				</div></span>
			</h1>
		</header>
		
		<div id="maindiv">
			<div id="nav">
			<c:choose>
				<c:when test="${sessionScope.user == null}">
					<div>
						<form name="form1" method="post" action="commonAction.do?method=UserLogin">
						账号：<input type="text" name="username"> 密码：<input type="password" name="password"> 
						<button onClick="loginsubmit();">登陆</button> <a href="commonAction.do?method=toRegister">注册新账号</a>
						</form>
					</div>
				</c:when>
				<c:otherwise>
					<div>
					&nbsp;&nbsp;<c:choose><c:when test="${sessionScope.user.nickname != ''}">${sessionScope.user.nickname}</c:when><c:otherwise>${sessionScope.user.username}</c:otherwise></c:choose>&nbsp;你好！<a
							href="commonAction.do?method=Logout">注销</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserInfo&uid=${sessionScope.user.id}">修改个人信息</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserPwd&uid=${sessionScope.user.id}">修改密码</a>
					</div>
				</c:otherwise>
			</c:choose>
				<a href="./" title="首页">首页</a>
				<span>&gt;</span>
                ${navigation}
			</div>
            
			<div id="board">
				<div class="bm">
					<div class="keyword cl">
						<ul class="cl">
							<li <c:if test="${keyword == ''}">class="curt"</c:if>><a href="commonAction.do?method=SortTopicInfo&superid=${superid}&sortid=${sortId}&param=1">全部</a></li>
                            <c:forEach items="${postkey}" var="key">
                            <c:if test="${key != ''}">
							<li <c:if test="${keyword == key}">class="curt"</c:if>><a href="commonAction.do?method=SortTopicInfo&superid=${superid}&sortid=${sortId}&param=1&keyword=${key}">${key}</a></li>
                            </c:if>
                            </c:forEach>
						</ul>
					</div>
					<div class="bm_h">
						<h2><span><a href="commonAction.do?method=SortTopicInfo&superid=${superid}&sortid=${sortId}&param=1&essence=1">精华</a> | <c:choose><c:when test="${view == '1'}"><a href="commonAction.do?method=SortTopicInfo&superid=${board.supersetid}&sortid=${board.id}&param=1&keyword=${keyword}">收起回复</a></c:when><c:otherwise><a href="commonAction.do?method=SortTopicInfo&superid=${board.supersetid}&sortid=${board.id}&param=1&view=1&keyword=${keyword}">显示回帖</a></c:otherwise></c:choose></span>${board.boardname}</h2>
					</div>
                    <div class="postlist_b">
                    	<div class="msg">
                            <span class="message cl"><div id="info"><c:if test="${info != ''}">${info}</c:if></div><span>
						</div>
                        <!--<c:set var="index" value="0" scope="request" />--><!-- 自增序号，注意scope-->  
                        <!--<c:set var="levelstr" value="0" scope="request" />--><!-- 记录树的层次，注意scope-->
                        <c:import url="__r.jsp" />
                    </div>
					<div class="pgt cl">
						<span><a href="commonAction.do?method=toTopicRespons&param=topic&id=${board.id}&paramsort=${paramsort}&lag=0"><IMG src="images/btn_07.gif" align="absMiddle" border="0" title="发表主题"></a></span>
						<div class="pg">
							<!--<strong>总帖量：${fn:length(TopicList)}</strong>
							<strong>每页 20 条</strong>
							<a href="###">首页</a>
							<a href="###">上一页</a>
							<a href="###">下一页</a>
							<a href="###">末页</a>
							<label>
								<select>
									<option>1</option>
								</select>
								<span> / 10页</span>
							</label>-->
                            <tools:page pagerName="commonAction.do" pagerSum="${pagerSum}" pagerSize="${pagerSize}"/>
						</div>
					</div>
					
				</div>
			</div>
		</div>
	<jsp:include page="inc/footer.jsp" />
</body>
</HTML>